package com.liangzhong.model.playerCenter.vo
{
	import com.common.utils.Debug;
	
	import flash.utils.ByteArray;

	/**
	 * 阵容Vo
	 *  
	 * @author Administrator
	 * 
	 */	
	public class BattlearrayVo
	{
		public function BattlearrayVo()
		{
		}
		/**
		 *所在阵容：1第一阵容，2第二阵容 
		 */
		public var formation :int;
		/**
		 * 阵容类型 ：
		 1--433,2--343,3--442,4--451,5--532,6--541 
		 */
		public var ntype:int;
		/**
		 *阵容List
		 *  
		 */
		public var battlearrayList:Array  = [];
		/**
		 * 增加位置球员
		 * @param $vo
		 * 
		 */
		public function addPlaceVo($vo:PlayerPlaceVo):void
		{
			formation = $vo.formation;
			ntype = $vo.ntype;
			battlearrayList.push($vo);
		}
		/**
		 *根据球员ID获取场上球员Vo 
		 * @param $id
		 * @return 
		 * 
		 */
		public function getPlaceVo($id:int):PlayerPlaceVo
		{
			for each(var vo:PlayerPlaceVo in battlearrayList)
			{
				if(vo.playerid == $id)
					return vo;
			}
			return null;
		}
		/**
		 *改变球员位置信息 
		 * @param buffer
		 * 
		 */
		public function changePlace(buffer:ByteArray):void
		{
			battlearrayList.splice(0,battlearrayList.length);
			var len:int = buffer.readShort();
			var vo:PlayerPlaceVo;
			for(var i:int = 0;i < len;i++)
			{
				vo = new PlayerPlaceVo();
				vo.playerid = buffer.readInt();
				vo.flasx = buffer.readShort();
				vo.flasy = buffer.readShort();
//				trace("playerId:-->"+ vo.playerid  +" X:-->" + vo.flasx + "  Y:-->" + vo.flasy );
				battlearrayList.push(vo);
			}
		}
	}
}